import unittest
from utils.file_util import FileUtil
import datetime
import dateutil.parser


class FileUtilTest(unittest.TestCase):
    def test_write_json_file(self):
        json_file = FileUtil.join_from_parent_dir(__file__, '../../temp', 'write_json_file.json')
        json = {}
        json["a"] = 1
        json["time"] = datetime.datetime.now()
        # json["objection"] = self.__dict__
        json["list"] = [[1, 2], [3, 4]]
        FileUtil.write_json_file(json_file, json)

        new_json = FileUtil.read_json_file(json_file)
        print(type(json["time"]))

        self.assertEqual(new_json["a"], json["a"])
